<template>
  <view class="my-container" :class="{ 'theme-dark': theme === 'dark', 'theme-light': theme === 'light' }">
    <!-- 用户信息卡片 -->
    <view class="user-card">
      <view class="user-info">
        <view class="user-avatar">
          <image class="avatar-img" src="/static/images/logo.png" />
        </view>
        <view class="user-details">
          <view class="user-name">未登录</view>
          <view class="user-bio">写签名会更容易获得别人的关注哦～</view>
        </view>
      </view>

      <!-- 统计数据 -->
      <view class="stats-container">
        <view class="stat-item">
          <text class="stat-number">171</text>
          <text class="stat-label">总点击</text>
        </view>
        <view class="stat-item">
          <text class="stat-number">24</text>
          <text class="stat-label">赞</text>
        </view>
        <view class="stat-item">
          <text class="stat-number">89</text>
          <text class="stat-label">关注</text>
        </view>
        <view class="stat-item">
          <text class="stat-number">653</text>
          <text class="stat-label">粉丝</text>
        </view>
      </view>
    </view>

    <!-- 设置开关 -->
    <view class="settings-row">
      <view class="setting-card">
        <view class="setting-info">
          <text class="setting-icon">💼</text>
          <view class="setting-content">
            <view class="setting-title">接单模式</view>
            <view class="setting-desc">已关闭</view>
          </view>
        </view>
        <wd-switch />
      </view>

      <view class="setting-card">
        <view class="setting-info">
          <text class="setting-icon">🔔</text>
          <view class="setting-content">
            <view class="setting-title">消息通知</view>
            <view class="setting-desc">已关闭</view>
          </view>
        </view>
        <wd-switch />
      </view>
    </view>

    <!-- 我的订单 -->
    <view class="order-card">
      <view class="card-title">
        <text class="title-icon">📋</text>
        <text class="title-text">我的订单</text>
      </view>
      <view class="order-grid">
        <view class="order-item">
          <text class="order-icon">💳</text>
          <text class="order-label">待付款</text>
        </view>
        <view class="order-item">
          <text class="order-icon">📦</text>
          <text class="order-label">未发货</text>
        </view>
        <view class="order-item">
          <text class="order-icon">🚚</text>
          <text class="order-label">已发货</text>
        </view>
        <view class="order-item">
          <text class="order-icon">🔄</text>
          <text class="order-label">售后/退款</text>
        </view>
      </view>
    </view>

    <!-- 退出登录 -->
    <view class="logout-card">
      <view class="logout-content">
        <text class="logout-icon">🚪</text>
        <text class="logout-text">退出登录</text>
      </view>
      <wd-icon name="chevron-right" size="20px" color="#9e9e9e"></wd-icon>
    </view>
  </view>
</template>

<script lang="ts" setup>
import { useTheme } from '@/hooks';

const { theme } = useTheme();
</script>

<style lang="scss" scoped>
.my-container {
  min-height: 100vh;
  background: var(--bsin-bgPrimary);
  padding: 40rpx 30rpx calc(60px + 40rpx + env(safe-area-inset-bottom));
  transition: background 0.3s ease;
  box-sizing: border-box;
}

/* 暗色模式背景 */
.my-container.theme-dark {
  background: var(--bsin-bgPrimary);
}

/* 用户信息卡片 */
.user-card {
  background: var(--bsin-bgCard);
  border-radius: 25rpx;
  padding: 40rpx;
  margin-bottom: 30rpx;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  transition:
    background 0.3s ease,
    box-shadow 0.3s ease;
}

.theme-dark .user-card {
  background: var(--bsin-bgCard);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(74, 85, 104, 0.3);
}

.user-info {
  display: flex;
  align-items: center;
  margin-bottom: 40rpx;
}

.user-avatar {
  margin-right: 30rpx;
}

.avatar-img {
  width: 120rpx;
  height: 120rpx;
  border-radius: 50%;
  border: 4px solid rgba(102, 126, 234, 0.2);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.user-details {
  flex: 1;
}

.user-name {
  font-size: 36rpx;
  font-weight: bold;
  color: #2d3748;
  margin-bottom: 10rpx;
  transition: color 0.3s ease;
}

.theme-dark .user-name {
  color: #e2e8f0;
}

.user-bio {
  font-size: 24rpx;
  color: #718096;
  line-height: 1.4;
  transition: color 0.3s ease;
}

.theme-dark .user-bio {
  color: #a0aec0;
}

/* 统计数据 */
.stats-container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20rpx;
  background: rgba(102, 126, 234, 0.1);
  padding: 30rpx;
  border-radius: 20rpx;
  backdrop-filter: blur(5px);
  transition: background 0.3s ease;
}

.theme-dark .stats-container {
  background: rgba(102, 126, 234, 0.15);
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.stat-number {
  font-size: 32rpx;
  font-weight: bold;
  color: #667eea;
  margin-bottom: 8rpx;
}

.stat-label {
  font-size: 22rpx;
  color: #718096;
  transition: color 0.3s ease;
}

.theme-dark .stat-label {
  color: #a0aec0;
}

/* 设置开关行 */
.settings-row {
  display: flex;
  gap: 20rpx;
  margin-bottom: 30rpx;
}

.setting-card {
  flex: 1;
  background: var(--bsin-bgCard);
  border-radius: 20rpx;
  padding: 30rpx;
  display: flex;
  align-items: center;
  justify-content: space-between;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  transition: all 0.3s ease;
}

.theme-dark .setting-card {
  background: var(--bsin-bgCard);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(74, 85, 104, 0.3);
}

.setting-card:active {
  transform: translateY(2rpx);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.theme-dark .setting-card:active {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.setting-info {
  display: flex;
  align-items: center;
  flex: 1;
}

.setting-icon {
  font-size: 32rpx;
  margin-right: 20rpx;
}

.setting-content {
  flex: 1;
}

.setting-title {
  font-size: 24rpx;
  font-weight: 600;
  color: #2d3748;
  margin-bottom: 6rpx;
  transition: color 0.3s ease;
}

.theme-dark .setting-title {
  color: #e2e8f0;
}

.setting-desc {
  font-size: 22rpx;
  color: #718096;
  transition: color 0.3s ease;
}

.theme-dark .setting-desc {
  color: #a0aec0;
}

/* 订单卡片 */
.order-card {
  background: var(--bsin-bgCard);
  border-radius: 25rpx;
  padding: 40rpx;
  margin-bottom: 30rpx;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  transition:
    background 0.3s ease,
    box-shadow 0.3s ease;
}

.theme-dark .order-card {
  background: var(--bsin-bgCard);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(74, 85, 104, 0.3);
}

.card-title {
  display: flex;
  align-items: center;
  margin-bottom: 30rpx;
}

.title-icon {
  font-size: 32rpx;
  margin-right: 15rpx;
}

.title-text {
  font-size: 32rpx;
  font-weight: bold;
  color: #2d3748;
  transition: color 0.3s ease;
}

.theme-dark .title-text {
  color: #e2e8f0;
}

.order-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20rpx;
}

.order-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20rpx;
  border-radius: 15rpx;
  background: rgba(102, 126, 234, 0.05);
  transition: all 0.3s ease;
}

.theme-dark .order-item {
  background: rgba(102, 126, 234, 0.1);
}

.order-item:active {
  transform: scale(0.95);
  background: rgba(102, 126, 234, 0.1);
}

.theme-dark .order-item:active {
  background: rgba(102, 126, 234, 0.2);
}

.order-icon {
  font-size: 32rpx;
  margin-bottom: 15rpx;
}

.order-label {
  font-size: 22rpx;
  color: #718096;
  text-align: center;
  transition: color 0.3s ease;
}

.theme-dark .order-label {
  color: #a0aec0;
}

/* 退出登录卡片 */
.logout-card {
  background: var(--bsin-bgCard);
  border-radius: 20rpx;
  padding: 30rpx;
  display: flex;
  align-items: center;
  justify-content: space-between;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  transition: all 0.3s ease;
}

.theme-dark .logout-card {
  background: var(--bsin-bgCard);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(74, 85, 104, 0.3);
}

.logout-card:active {
  transform: translateY(2rpx);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.theme-dark .logout-card:active {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.logout-content {
  display: flex;
  align-items: center;
}

.logout-icon {
  font-size: 32rpx;
  margin-right: 20rpx;
}

.logout-text {
  font-size: 30rpx;
  font-weight: 500;
  color: #2d3748;
  transition: color 0.3s ease;
}

.theme-dark .logout-text {
  color: #e2e8f0;
}

/* 响应式设计 */
@media (max-width: 375px) {
  .my-container {
    padding: 30rpx 20rpx calc(60px + 30rpx + env(safe-area-inset-bottom));
  }

  .user-card,
  .order-card {
    padding: 30rpx;
  }

  .avatar-img {
    width: 100rpx;
    height: 100rpx;
  }

  .user-name {
    font-size: 32rpx;
  }

  .user-bio {
    font-size: 22rpx;
  }

  .stats-container {
    padding: 25rpx;
    gap: 15rpx;
  }

  .stat-number {
    font-size: 28rpx;
  }

  .stat-label {
    font-size: 20rpx;
  }

  .settings-row {
    flex-direction: column;
    gap: 15rpx;
  }

  .setting-card {
    padding: 25rpx;
  }

  .order-grid {
    gap: 15rpx;
  }

  .order-item {
    padding: 15rpx;
  }

  .order-icon {
    font-size: 28rpx;
  }

  .order-label {
    font-size: 20rpx;
  }
}
</style>
